<html>
<head><meta charset="utf-8"><title>bikeshedding references terminology · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/bikeshedding.20references.20terminology.html">bikeshedding references terminology</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="182326508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/bikeshedding%20references%20terminology/near/182326508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Elichai Turkel <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/bikeshedding.20references.20terminology.html#182326508">(Dec 02 2019 at 09:13)</a>:</h4>
<p>Currently in rust we call <code>let ptr = &amp;mut T</code> a <code>mutable reference to T</code>. the reason AFAIK is mostly because that reference is unique, the reference is the "special" part here.<br>
but in C it would be <code>a const pointer to a mutable T</code>.<br>
this is all fine and good until we get  to <code>let mut ptr = &amp;b</code> and <code>foo(mut ptr: &amp;T)</code>.<br>
how is that called? again in C that'll be a <code>mutable pointer to a const T</code> <br>
in rust will this be called a <code>mutable reference holding a T</code>? something else?</p>
<p>cc <span class="user-mention" data-user-id="120791">@RalfJ</span> (guessed you might be interested in this, otherwise please ignore)</p>



<a name="182333944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/bikeshedding%20references%20terminology/near/182333944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/bikeshedding.20references.20terminology.html#182333944">(Dec 02 2019 at 10:53)</a>:</h4>
<p>My solution is to clearly separate the place from the type. So I don't call <code>let mut x: i32;</code> a mutable integer, it's just an i32, if the mutability needs to be pointed out then I say it's a mutable variable. Likewise &amp;T is just always a (shared) reference, and if I need to point out that a place of that type is mut, I word it so that the "mutable" is not adjacent to the type description but associated with the place that's mutable.</p>



<a name="182334204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/bikeshedding%20references%20terminology/near/182334204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/bikeshedding.20references.20terminology.html#182334204">(Dec 02 2019 at 10:57)</a>:</h4>
<p>I think similarly. Above <code>ptr</code> is just a place, containing an exclusive reference to a <code>T</code>. Whether the place is read-only or read-write is orthogonal to what it contains.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>